<?php
header("content-type:text/html;charset=utf-8");
include("./API.php");
include("../config.php");
tongji("neran");
$hh=$_GET["hh"]?:"\n";//换行符号(默认\n)
function post_data_test($url,$data){
$curl = curl_init(); 
curl_setopt($curl, CURLOPT_URL, $url); 
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); 
curl_setopt($curl, CURLOPT_POST, 1); 
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); 
curl_setopt($curl, CURLOPT_TIMEOUT, 30); 
curl_setopt($curl, CURLOPT_HEADER, 0); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl); 
if (curl_errno($curl)) {
echo "".$web["ming"]."API网易云随机歌曲".$hh."";
echo "━━━━━━━━━".$hh."";
echo "错误信息;'".curl_error($curl)."".$hh."";
echo "━━━━━━━━━".$hh."";
echo "Tips:".$web["ming"]."API技术支持";
}
curl_close($curl); 
return $result; 
}
$url="http://music.163.com/weapi/v6/playlist/detail";
$data="params=qf1LzUWiKJ8ZLGNSrNc2Bi3PJIvx4ou9jDaHhwhQ3ltpMI9Kl0meiHnf9aNm5cIR&encSecKey=5b67749ef6ed3eaa5581683b7f2beaaabd20ffa38e325a617cde4db03a27c207de6c481a1113448c87f26bc13c5c92023b7ae332d673d601ae8a42116b89f1d1916ac217a6e41d66ad68aca4a4854d112b50b192a3b8fc56fa963173dec1314fbee035ac3d68ad9dae3778eea78f99d318d9e0d4f7a5fa3eea552891d426f6d4";
$data=post_data_test($url,$data);
$data=str_replace("[", "【", $data);
$data=str_replace("]", "】", $data);
preg_match_all('/网易云音乐官方账号(.*?)trackIds/',$data,$bb);
$bb=$bb[1][0];
$arr=mt_rand(1,18);
preg_match_all('/{\"name\":\"(.*?)\",\"id\":(.*?),\"pst\":(.*?),\"t\":(.*?),\"ar\":【{\"id\":(.*?),\"name\":\"(.*?)\",\"tns\":【(.*?)】,\"alias\":【(.*?)】}】,\"alia\":【(.*?)】,\"pop\":(.*?),\"st\":(.*?),\"rt\":\"(.*?)\",\"fee\":(.*?),\"v\":(.*?),\"crbt\":(.*?),\"cf\":\"(.*?)\",\"al\":{\"id\":(.*?),\"name\":\"(.*?)\",\"picUrl\":\"(.*?)\",\"tns\":【(.*?)】,\"pic_str\":\"(.*?)\",\"pic\":(.*?)}/',$bb,$po);
$dd=$po[19][$arr];//图片
$aa=$po[1][$arr];//歌名
$cc=$po[6][$arr];//歌手
$bb=$po[2][$arr];//歌曲ID
if($_GET['type']=="xml"){
echo 'card:1<?xml version=\'1.0\' encoding=\'UTF-8\' standalone=\'yes\' ?><msg serviceID="2" templateID="1" action="web" brief="[分享]'.$aa.'" sourceMsgId="0" url="" flag="0" adverSign="0" multiMsgFlag="0"><item layout="2"><audio cover="'.$dd.'" src="http://music.163.com/song/media/outer/url?id='.$bb.'" /><title>'.$aa.'</title><summary>'.$cc.'</summary></item><source name="" icon="" action="app" a_actionData="com.tencent.qqmusic" i_actionData="tencent1101079856://" appid="1101079856" /></msg>';
exit;}
echo "".$web["ming"]."API网易云随机歌曲".$hh."";
echo "━━━━━━━━━".$hh."";
echo "±img=".$dd."±".$hh."";
echo "歌名：".$aa."".$hh."";
echo "歌手：".$cc."".$hh."";
echo "歌曲ID：".$bb."".$hh."";
echo "播放链接：http://music.163.com/song/media/outer/url?id=".$bb."".$hh."";
echo "━━━━━━━━━".$hh."";
echo "Tips:".$web["ming"]."API技术支持";
?>